//
//  LGDCTableHead.h
//  ALS3.0
//
//  Created by guomianxiang on 2017/4/7.
//  Copyright © 2017年 guomianxiang. All rights reserved.
//

#ifndef LGDCTableHead_h
#define LGDCTableHead_h


#import "LGDCBaseCell.h"
#import "LGEditCell.h"
#import "LGSketchCell.h"
#import "LGButtonCell.h"
#import "LGHeadCell.h"
#import "LGOpenDoorCell.h"
#import "LGSearchCell.h"
#import "LGShowCell.h"
#import "LGDislikeDoorCell.h"

#import "LGDCCellContent.h"

#import "LGControllerManager.h"
#import "LGController.h"
#import "LGDoor.h"


#define k_Height_DefaultCell 44
#define k_Height_EditCell_Presentation 52
#define k_Height_HeadCell 124
#define k_Height_SketchCell 68
#define k_Height_OpenDoorCell 120


// 注册cell
#define k_registerNib(tableView) NSString *str = NSStringFromClass([LGSketchCell class]);\
[(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
str = NSStringFromClass([LGDislikeDoorCell class]);\
[(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
str = NSStringFromClass([LGButtonCell class]);\
[(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
str = NSStringFromClass([LGEditCell class]);\
[(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
str = NSStringFromClass([LGHeadCell class]);\
[(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
str = NSStringFromClass([LGOpenDoorCell class]);\
[(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
str = NSStringFromClass([LGSearchCell class]);\
[(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
str = NSStringFromClass([LGShowCell class]);\
[(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\

// tableviewdatasource 和 cell高度
#define k_tableViewDataSourceAndCellHeight(tableDataArr,cellDelegate) - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {\
return self.tableDataArr.count;\
}\
\
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {\
return self.tableDataArr[section].count;\
}\
\
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\
\
LGDCCellContent *content = self.tableDataArr[indexPath.section][indexPath.row];\
content.indexPath = indexPath;\
LGDCBaseCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(content.cellClass)];\
cell.delegate = cellDelegate;\
cell.content = content;\
return cell;\
}\
\
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {\
return self.tableDataArr[indexPath.section][indexPath.row].cellHeight;\
}


//NSString *str = NSStringFromClass([LGSketchCell class]);\
//[self.(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
//str = NSStringFromClass([LGButtonCell class]);\
//[self.(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
//str = NSStringFromClass([LGEditCell class]);\
//[self.(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
//str = NSStringFromClass([LGHeadCell class]);\
//[self.(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
//str = NSStringFromClass([LGOpenDoorCell class]);\
//[self.(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
//str = NSStringFromClass([LGSearchCell class]);\
//[self.(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\
//str = NSStringFromClass([LGShowCell class]);\
//[self.(tableView) registerNib:[UINib nibWithNibName:str bundle:[NSBundle mainBundle]] forCellReuseIdentifier:str];\

#endif /* LGDCTableHead_h */
